package com.zjj.lbw.springbootstu.handwriting.config;

import com.zjj.lbw.springbootstu.handwriting.annotation.ZjjConditionalOnClass;
import com.zjj.lbw.springbootstu.handwriting.intf.AutoConfiguration;
import com.zjj.lbw.springbootstu.handwriting.webserver.JettyWebServer;
import com.zjj.lbw.springbootstu.handwriting.webserver.TomcatWebServer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author zhanglei.zjj
 * @description web容器自动装配类
 * @date 2023/6/24 11:20
 */
@Configuration
public class WebServiceAutoConfiguration implements AutoConfiguration {
    @Bean
    @ZjjConditionalOnClass("org.apache.catalina.startup.Tomcat")
    public TomcatWebServer tomcatWebServer(){
        return new TomcatWebServer();
    }

    @Bean
    @ZjjConditionalOnClass("org.eclipse.jetty.server.Server")
    public JettyWebServer jettyWebServer(){
        return new JettyWebServer();
    }
}
